#ifndef SNAKE3_H
#define SNAKE3_H

#include <QMainWindow>

namespace Ui {
class Snake3;
}

class Snake3 : public QMainWindow
{
    Q_OBJECT

public:
    explicit Snake3(QWidget *parent = 0);
    ~Snake3();
    void paintEvent(QPaintEvent *event);
        void initSnake();
        void initBoom();
        QRect CreateRect();
        void IsEat();
        void IsHit();
        void IsBoom();
        void IsLose();
        void keyPressEvent(QKeyEvent *event);
    private slots:
        void Snake_update();


private:
    Ui::Snake3 *ui;
    QVector<QRect> vSnakeRect;
        QRect vSnakeHead;
        QTimer *timer;//定时器
        int Direction;//蛇的移动方向
        bool Run;//是否开始
        bool Over;//是否结束
        bool Change;//炸弹是否变化
        bool Shorten;//是否缩短
        QRect food;
        QVector<QRect> boom;//炸弹
        int nScore;
        int speed;//移动速度
};

#endif // SNAKE3_H
